/*
 * BusinessService.java
 *
 * Copyright (c) 2008 Teamnet. All Rights Reserved.
 *
 * This source file may not be copied, modified or redistributed,
 * in whole or in part, in any form or for any reason, without the express
 * written consent of Teamnet.
 */

package ro.prjmanager.template.form.backend;

import ro.prjmanager.database.model.Table;
import ro.prjmanager.constants.BackendConstants;

/**
 * This class is used to override some attributes from BackendModuleForm
 */
public class BusinessServiceForm extends BackendModuleForm{
    //the current Table ussed in generating files from templates
    private Table table;
    //the package coresponding to dao
    private String daoPackage;
    /**
     * Default constructor
     * @param table - the table for that are generating the mappings
     */
     public BusinessServiceForm(Table table) {
        super();
        DAOForm daoForm=new DAOForm();
        this.daoPackage=daoForm.getRelativeToRootPackage();

        this.table=table;
        this.relativeToRootPackage = bundle.getString(BackendConstants.APPLICATION_BACKEND_BUSINESS_RELATIVE_PACKAGE);

        this.relativeToRootPath = this.relativeToRootPackage.indexOf(BackendConstants.PACKAGE_SEPARATOR)>0?
        this.relativeToRootPackage.replace(BackendConstants.PACKAGE_SEPARATOR,
                BackendConstants.PATH_SEPARATOR):this.relativeToRootPackage;
        this.templatePath=bundle.getString(BackendConstants.APPLICATION_BACKEND_BUSINESS_SERVICE_TEMPLATE_PATH) ;
        javaFileName=getTable().getJavaName()+ BackendConstants.SERVICE;
    }

    public Table getTable() {
        return table;
    }

    public void setTable(Table table) {
        this.table = table;
    }
    public String getDaoPackage() {
        return daoPackage;
    }

    public void setDaoPackage(String daoPackage) {
        this.daoPackage = daoPackage;
    }
}
